package com.quanquan.store.controller.pagePoint.service;

import com.quanquan.store.controller.pagePoint.entity.Page;
import com.quanquan.store.controller.pagePoint.entity.PageData;
import com.quanquan.store.controller.pagePoint.entity.PageParams;
import com.quanquan.store.controller.pagePoint.repository.PageDataRepository;
import com.quanquan.store.controller.pagePoint.repository.PageParamsRepository;
import com.quanquan.store.controller.pagePoint.repository.PageRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName PagePointService
 * @Description
 * @Author Owen
 * @Date 2019/11/14 0014 下午 3:22
 * @Version V1.0
 **/
@Service
public class PagePointService {

    @Autowired
    private PageRepository pageRepository;

    @Autowired
    private PageDataRepository pageDataRepository;

    @Autowired
    private PageParamsRepository pageParamsRepository;

    public Page getPage(String pageUrl){
        return pageRepository.findByPageUrl(pageUrl);
    }

    public Page savePage(Page page){
        return pageRepository.saveAndFlush(page);
    }

    public PageData savePageData(PageData pageData){
        return pageDataRepository.saveAndFlush(pageData);
    }

    public PageParams savePageParams(PageParams pageParams){
        return pageParamsRepository.saveAndFlush(pageParams);
    }
}
